<?php
/**
 * Created by PhpStorm.
 * User: 10851
 * Date: 2017/9/23
 * Time: 22:59
 */
header('content-type:text/html;charset=uft-8');
require_once '../config/config.php';
require_once '../functions/common.func.php';
require_once '../functions/mysql.func.php';
$link = connect3();
$table = 'cs_yg';
$id = isset($_GET["id"])?$_GET["id"]:"";
if ($id==""){
      $username = $_GET['username'];
      $ygid = $_GET['ygid'];
      $age = $_GET['age'];
      $sex = $_GET['sex'];
      $data = compact('username','ygid','age','sex');
      $res = insert($link,$data,$table);
      if ($res){
          alertMes('插入数据成功','layout-index.php');
      }else{
          alertMes('插入数据失败','layout-index.php');
      }

}else{
     delete($link,$table,'id='.$id);
}